package com.leetcode.algs4.graph.least_path;

/**
 * @author Dennis Li
 * @date 2020/6/19 10:04
 */
public class DijkstraAllPairsSP {

    // 为每一个点创建他到其他点的最短路径组
    private DijkstraSP[] all;

    public DijkstraAllPairsSP(EdgeWeightedDigraph G) {
        all = new DijkstraSP[G.V()];
        for (int v = 0; v < G.V(); v++) {
            all[v] = new DijkstraSP(G, v);
        }
    }

    public Iterable<DirectedEdge> pathTo(int s, int t) {
        return all[s].pathTo(t);
    }

    public double dist(int s, int t) {
        return all[s].distTo(t);
    }
}
